/*
 * File:   data_memory.h
 * Author: Yongkang Li
 * Created on December 7, 2023
 */

#pragma once

#include <unordered_map>
#include <cstring>
#include <iostream>

const std::string PREV_PREFIX = "_prev_";
const int PREV_PREFIX_LEN = PREV_PREFIX.length();

class DataMemory
{
public:
    static std::unordered_map<std::string, int> data;
    static std::unordered_map<std::string, int> prev_data;

    static void set_val(const std::string &var_name, int val);;

    static int get_val_auto(const std::string &var_name);
    static int get_val(const std::string &var_name);
    static int get_prev_val(const std::string &var_name);

    static void save_snapshot();
    static void clear();
};
